// Stop the spawn effect

local function Load()
	local function Create(Player, Pos, Ang, Model, Physics, Data)
		// Set data
		
		Data.Pos = Pos
		Data.Angle = Ang
		Data.Model = Model

		// Make sure this is allowed
		
		if (!gamemode.Call( "PlayerSpawnProp", Player, Model)) then return end
		
		local Entity = ents.Create("prop_physics")
		
		duplicator.DoGeneric(Entity, Data)
		
		Entity:Spawn()
		
		duplicator.DoGenericPhysics(Entity, Player, Data)
		duplicator.DoFlex(Entity, Data.Flex, Data.FlexScale)
		
		// Tell the gamemode we just spawned something
		
		gamemode.Call("PlayerSpawnedProp", Player, Model, Entity)
		
		if not (Data.ContraptionSaver) then
			DoPropSpawnedEffect(Entity)
		end
		
		return Entity
	end

	duplicator.RegisterEntityClass("prop_physics", Create, "Pos", "Ang", "Model", "PhysicsObjects", "Data")
end

ContraptionSaver.Hooks.Add("Initialize", Load)